package com.freesun.autoui.product.healthcenter.pageaction;

import com.freesun.autoui.product.healthcenter.pagemodel.LogOutPageModel;
import com.freesun.autoui.product.healthcenter.pagemodel.LoginPageModel;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * desc: logpageaction
 * Created by yangfei on 13-12-31.
 */
public class LoginPageAction {

    private static Logger log = LoggerFactory.getLogger(LoginPageAction.class.getClass());
    /**
     * @desc 用户登录
     * @param driver
     */
    public static void loginIn(WebDriver driver,String url,String username,String password){

        log.warn("进入:"+url);
        driver.get(url);
        LoginPageModel.loginId(driver).sendKeys(username);
        LoginPageModel.passWord(driver).sendKeys(password);
        LoginPageModel.submitLogin(driver).click();
    }

    public static String checkText(WebDriver driver,String intoUrl){
        log.warn("进入:"+intoUrl);
        driver.navigate().to(intoUrl);
        String text= LogOutPageModel.logOut(driver).getText();
        return text;
    }
}
